package thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test3 {
	public static void main(String[] args) throws InterruptedException {
//		ExecutorService pool1 = Executors.newFixedThreadPool(2);
		ExecutorService pool1 = Executors.newCachedThreadPool();
		
		Mythread1 t1 = new Mythread1("name1");
		Mythread1 t2 = new Mythread1("name2");
		Mythread1 t3 = new Mythread1("name3");
		pool1.execute(t1);
		pool1.execute(t2);
		pool1.execute(t3);
		
	}

}

class Mythread1 implements Runnable{
	private String name;
	
	public Mythread1(String name) {
		super();
		this.name = name;
	}
	
	@Override
	public void run() {
		// TODO Auto-generated method stub
		for(int i=0; i<100; i++){
			System.out.println("name: "+name);
		}
	}
	
}